package lab02.test21;

import java.util.Scanner;

/**
 * Created by 14394 on 2017/11/13.
 */
public class Test {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        System.out.println("请输入你要实验的字符串：");
        String content=s.next();
        System.out.println("请输入你要实验的字符：");
        byte theChar=s.nextByte();
        int time=0;
        int size=content.getBytes().length;
        for (int i=0;i<size;){
            char tmp=content.charAt(i++);
            if (tmp==theChar) time++;
        }
        System.out.println("该字符出现的频率："+size/time);
    }
}
